<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Platform User Assistance Enhancements</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <link href="http://dev.eclipse.org/default_style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
table,td,th { font-size: 10pt; font-family: arial, helvetica, geneva;}
</style>
<style media="screen" type="text/css">
th {background-color: #334070; color:#ffffff;}
.on {background-color: #ffff66;}
</style>
<style type="text/css" media="print">
.on {font-weight: bold;}
</style>

<style type="text/css">
<!--
.style2 {font-family: Arial, Helvetica, sans-serif}
.style3 {font-size: medium; font-family: Arial, Helvetica, sans-serif; }
.style5 {font-size: 10pt}
.style8 {font-family: "Courier New", Courier, mono}
.style10 {font-family: "Courier New", Courier, mono; font-size: 10pt; }
.style12 {
	font-size: 10pt;
	font-weight: bold;
	font-family: "Courier New", Courier, monospace;
}
-->
</style>
</head>
<body>
<table width="100%">
  <tbody>
    <tr>
      <td
 style="background: rgb(0, 128, 192) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><b><span
 style="color: white;">Proposal</span></b></td>
    </tr>
  </tbody>
</table>
<center>
  <h2><a>Dynamic Content in Eclipse Help System Pages</a></h2>
</center>
<blockquote>
  <p><strong>Summary </strong><br />
    This document describes a proposal to introduce dynamic and reusable content in the Eclipse Help System pages. This support will be part of the Eclipse 3.2 release and will be introduced in M4. It is expected that apis will be finalized by M5. </p>
</blockquote>
<h3>&nbsp;</h3>
<h3>The Problem</h3>
<p>With the widespread popularity of the Eclipse platform as the base for many software products and with the increasing scope of the technology behind these products, the size of the online documentation is also scaling accordingly. This puts more emphasis on  supporting reusable and dynamic content in the Eclipse Help System documentation pages. The requirement is that it should be possible to reuse content, and this can be accomplished in two ways: by including content from another existing page, or by contributing  content to an existing help system page. Also, conditional filtering is needed to allow for exposing only the appropriate portion of the documentation to the end user. Portions of content can  be made visible to the end user based on certain filtering criteria. <br />
</p>
<h3 align="left">Proposed Solution</h3>
<p align="left">As of Eclipse 3.1, Help System documents where static. They where html documents that where served statically and as-is to the Help System browser. In order to enable dynamic content manipulation  Help documents, the content of these files needs to be parsed, manipulated and then served to the browser. To enable this, a new support for using XHTML documents as pages in the Help System is added. </p>
<p align="left">XHTML pages are contributed and used in a TOC just like any other html page. The only difference is that the declaring plugin that hosts these pages needs to declare to the Help system that it is a special plugin and that it needs to be consulted when pages are to be served from this plugin. This is done using an existing Help System extension point called <a href="http://help.eclipse.org/help31/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_help_contentProducer.html">org.eclipse.help.contentProducer</a>. The only difference is that the plugin will reuse an existing pre-supplied class that will handle all the content from this plugin, including the XHTML pages. Here is how a plugin would declare itself as a plugin that needs to serve XHTML documents: </p>
<pre>&lt;extension point=&quot;org.eclipse.help.contentProducer&quot;
  id=&quot;some.id.dynamicContentProducer&quot;
  name=&quot;XHTML content producer&quot;&gt;
   &lt;contentProducer
    producer=&quot;org.eclipse.help.internal.DynamicContentProducer&quot;&gt;
   &lt;/contentProducer&gt;
 &lt;/extension&gt; </pre>
<p align="left">With the above declaration, a plugin can then define and contribute XHTML pages in  TOCs  just like any other html page. These XHTML pages can now be displayed as is, or they can be manipulated to support dynamic content and filtering. The rest of the document will describe how conditional filtering and dynamic content will be supported. </p>
<p align="left">&nbsp;</p>
<h3 align="left">Conditional Filtering</h3>
Portions of a Help document need to be filtered out based on certain conditions. These conditions are operating system (os), windowing system (ws), Eclipse platform category, activity, or product, and finaly, the existence of a given plugin in the current install. Also, user defined filtering keys can be used as filtering criteria. These would be defined as system properties that are passed to the vm, and they would then be used in documents to control filtering. A filter can be applied to any element in an XHTML document. If an element has a filter applied to it, the it will only be shown if the filtering criteria is met. 
<h4 align="left">Filtering by pre-defined properties</h4>
<p align="left" class="style2">Here is how an element (for example, a paragraph) in an XHTML document can be filtered using pre-defined filtering criteria: </p>
<pre class="style3"><span class="style5"><span class="style8"><strong>filtering by OS:
&lt;p filter=&quot;os=</strong>win32,linux<strong>&quot;&gt;</strong>
   This text should only show up when running on a Win32 or a Linux based operating system.
   Short hand version of the filter element can only be used for a single filter criteria.
   Colon separated values of the filter attribute represent multiple values.
&lt;/p&gt;

<strong>filtering by WS:</strong>
<strong>&lt;p filter=&quot;ws=</strong>win32<strong>&quot;&gt;</strong>
   This text should only show up when running on a machine using the Windows windowing system.
&lt;/p&gt;

<strong>filtering by Eclipse Category:</strong>
<strong>&lt;p filter=&quot;category=</strong>org.eclipse.categories.developmentCategory<strong>&quot;&gt;</strong>
   This text should only show up when the Development category defined in the Eclipse 
   SDK is enabled.
&lt;/p&gt;<strong>

filtering by Eclipse Activity:
&lt;p filter=&quot;activity=</strong>org.eclipse.javaDevelopment<strong>&quot;&gt;</strong>
   This text should only show up when the Java Development activity defined in the Eclipse 
   SDK is enabled.
&lt;/p&gt;</span></span>

<span class="style12">filtering based on the existance of an Eclipse Plugin:</span>
<span class="style10"><strong>&lt;p filter=&quot;plugin=</strong>org.eclipse.platform<strong>&quot;&gt;</strong>
   This text should only show up if the org.eclpise.platform plugin is installed and is 
   in an active state.
&lt;/p&gt;</span>

<span class="style12">filtering by Eclipse Product:</span>
<span class="style10"><strong>&lt;p filter=&quot;product=</strong>org.eclipse.platform.ide<strong>&quot;&gt;</strong>
   This text should only show up when the platform is run as a product with 
   id org.eclipse.platform.ide.
&lt;/p&gt;</span>
<em class="style8 style5">   note: filtering by &quot;product&quot; and &quot;plugin&quot; is not implemented in M4. Will be in M5.</em>
</pre>

 <h4><span class="style3"><br>  
  </span>Filtering by multiple criteria</h4>
<span class="style2">When there is a need to filter by multiple criteria, the filtering markup is different. In the simple cases above, the filtering markup was tagged to the XHTML element as an attribute. When two or more filtering criteria are needed, the filtering markup is tagged as a child element of the XHTML element to be filtered. Here are two examples: </span><br>
 <pre class="style8">
&lt;p&gt;
   This text should only show up when running product <span class="style10">org.eclipse.platform.ide</span> on 
   a Win32 based operating system.
<strong>   &lt;filter name=&quot;os&quot; value=&quot;</strong>win32<strong>&quot; /&gt;
   &lt;filter name=&quot;product&quot; value=&quot;</strong><span class="style10">org.eclipse.platform.ide</span><strong>&quot; /&gt;</strong>
&lt;/p&gt;

&lt;p&gt;
   This text should only show up when running on a Win32 or a Linux based operating system,
   and when  Development category defined in the Eclipse SDK is enabled.
<strong>   &lt;filter name=&quot;os&quot; value=&quot;</strong>win32,linux<strong>&quot; /&gt;
   &lt;filter name=&quot;category&quot; value=&quot;</strong>org.eclipse.categories.developmentCategory<strong>&quot; /&gt;</strong>
&lt;/p&gt;<strong>

</strong><em class="style8 style5">note: filtering by multiple criteria is not implemented in M4. Will be in M5.</em></pre>
 <h4><span class="style8"><br>   
   </span>Filtering by user defined criteria </h4>
 User defined keys can be used as filtering criteria. This is done by passing a key/value pair as a Java system property to the VM running the Eclipse platform. The Help system pages can then be filtered based on this key/value pair. For example, only if you pass &quot;-Dauthor=john smith&quot; to the vm at runtime, would the following paragraph show up: <br>
 <pre class="style8">
&lt;p&gt;
   This text should only show up on Linux when the Java system property &quot;author&quot; has the 
   value &quot;john smith&quot;.
   <strong>&lt;filter name=&quot;os&quot; value=&quot;</strong>linux<strong>&quot;/&gt;
   &lt;filter name=&quot;author&quot; value=&quot;</strong>john smith<strong>&quot;./&gt;</strong>
&lt;/p&gt;</pre>
 <h3><br>
   <br>
Dynamic Content</h3>
 <p>Filtering can be essential in presenting to the end user the appropriate portion of the online documentation based on a set of criteria. However, there is also a need to support dynamic content in Help pages that follows the same architecture as  the platform. Instead of static pages, Help system pages become dynamic pages that are assembled at runtime into coherent pages depending on the markup used in the page. This dynamic nature can be accomplished by two concepts: including content from existing pages and contributing content to existing pages.  <br>
 </p>
 <h4>Content reuse using Includes</h4>
 <p class="style2">To support content reuse, a new Eclipse-specific element is introduced to the XHTML markup. The &lt;<span class="style8">include</span>&gt; element enables documents to be built top down. Authors &quot;include&quot; content from any Help document by referencing the content in the target document as follows:</p>
 <p class="style2">&lt;<span class="style8">include path=&quot;<em>plugin_id/path_to_xhtml_file/id_of_element_to_include</em>&quot; </span>/&gt;</p>
<p class="style2">The above markup can be included in a Help document. By specifying the id of the target plugin, the target page and the target element to be included, the markup can then be resolved at runtime and  the content  copied into the location where this include element was inserted. <br />
</p>
<h4>Content contribution using  Anchors</h4>
<p class="style2">Dynamic content can also be accomplished using content contribution into existing documents. The  Eclipse-specific element &lt;<span class="style8">anchor</span>&gt;  enables documents to be built bottom up. A Help document can define one or more anchors to declare its willingness to accept contributions. Anchors act as place holders that declare that their location is open for content contributions.  Authors subsequently &quot;contribute&quot; content into any Help document by referencing an anchor in that document.  A new extension point is introduced for this support. </p>
<pre class="style8">&lt;extension point= "org.eclipse.help.contentExtension"&gt; 
 	&lt;contentExtension file="contentExtensionFile.xml&quot;/&gt;
&lt;/extension&gt;</pre>
<span class="style8"><span class="style2">The above extension specifies the file that defines the content to be contributed and the target location of where this content needs to be inserted. The file  </span>contentExtensionFile.xml</span><span class="style2"> is an XML file that has the following syntax:</span><br>
<br>
<pre> &lt;contentExtension&gt;
	 &lt;topicExtension content=&quot;plugin/relative/path/topicExtensionFile.xhml&quot; 
		path=<span class="style2">&quot;<em><em>plugin_id/path_to_xhtml_file</em>/anchor_id</em>&quot;</span>/&gt;
	 &lt;topicReplace content="topicReplaceFile.xhml&quot; path=<span class="style2">&quot;<em><em>plugin_id/path_to_xhtml_file</em>/element_id</em>&quot; </span>/&gt;
 &lt;/contentExtension&gt;</pre>
<p><code>topicExtension</code> is the markup used to insert content at the target anchor location. <code>topicReplace</code> is the markup used to replace the content of the target element by the specified content. In other words, content can be contributed that either adds to the target location or replaces the content of the target location. </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

